<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="../common/common.jsp" %>
<%
if(beforeURL.indexOf("user_login.jsp")>0)
{
    beforeURL = "main.jsp";  
}
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=SYSTITLE%> - 用户登录</title>
<meta name="Keywords" content="<%=SYSMETAKEY%>" />
<meta name="Description" content="<%=SYSMETADESC%>" />
<%@ include file="../common/meta.inc" %>
<STYLE type="text/css" media="screen">
@import url(css/defaultStyle.css);
</STYLE>
</head>
<body>
<%@ include file="../common/waiting.inc" %>
<script language="javascript" type="text/javascript" src="scripts/userLogin.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/prototype.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/buffalo/buffalo.js"></script>
<script language="javascript" type="text/javascript">

setStatus('<%=SYSTITLE%> - 用户登录');

var END_POINT="${pageContext.request.contextPath}/buffalo";
var buffalo = new Buffalo(END_POINT,false);
function doSubmit() 
{	
	form = document.theform;
	if(!validateUserLoginForm(form))
		return false;		
		
    var obj = {};    
    
	obj[Buffalo.BOCLASS] = "java.util.HashMap";

	var loginId = trim($F('loginId'));
	var password = $F('password');
	var loginIp = "<%=request.getRemoteAddr()%>";	
	
	var validDays = parseInt($F('validDays'));
	var userStyle = parseInt(getRadioValue('userStyle'));
	var hiddenFlag = parseInt(getRadioValue('hiddenFlag'));
	buffalo.remoteCall("userServiceAjaxService.userLoginAjax",[loginId,password,loginIp,validDays,userStyle,hiddenFlag], function(reply) 
    {
       	var ret = reply.getResult();
       	var params = parseAjaxReturn(ret);			
       	if(params=="error")
       	{
       		sl_alert(ret);       		
       	}
       	else
       	{ 	
       		sl_alert("登陆成功！");
       		location.href = "<%=beforeURL%>";
        }  
	       	    	
    });	  
}
</script>
<script language="javascript" type="text/javascript" src="template/scripts/topBar.js"></script>
<DIV class="line"></DIV>
<DIV class="list_table_0">
<%=HtmlConst.navMenu("user_login.jsp","用户登录")%>
</DIV>
<DIV class="line"></DIV>
<form name="theform" id=""theform"" method="post" action="" target="_self" onSubmit="return validateUserLoginForm(this);">
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" class="tab">
<%=HtmlConst.tableError(Utility.trimNull(request.getAttribute("ERROR_MSG")),2)%>
<tr>
<td width="200" align="right" class="bg2">
<strong>登陆名</strong></td>
<td class="bg2">
<input name="loginId" type="text" id="loginId" size="20" maxlength="20"  style="width:180px;" />
</td>
</tr>
<tr>
<td align="right" class="bg2"><strong>登陆密码</strong></td>
<td class="bg2">
<input name="password" type="password" id="password" size="20" maxlength="20"  style="width:180px;" />
</td>
</tr>
<tr>
<td align="right" class="bg2"><strong>登陆保存时间</strong></td>
<td class="bg2"><select name="validDays" id="validDays">
    <option value="0" selected="selected">即时有效</option>
    <option value="3">保存3天</option>
    <option value="7">保存7天</option>
    <option value="15">保存15天</option>
    <option value="30">保存30天</option>
    <option value="90">保存90天</option>
    <option value="365">保存365天</option>
  </select>
</td>
</tr>
<tr>
<td align="right" class="bg2"><strong>登陆风格</strong></td>
<td class="bg2">
<input name="userStyle" type="radio" value="0" checked="checked" />BBS风格
&nbsp;&nbsp;
<input type="radio" name="userStyle" value="1" />讨论区风格
</td>
</tr>
<tr>
<td align="right" class="bg2"><strong>登陆方式</strong></td>
<td class="bg2"><input type="radio" name="hiddenFlag" value="0" checked="checked" />正常登陆&nbsp;&nbsp;
	<input type="radio" name="hiddenFlag" value="1"/>隐身登陆
</td>
</tr>
<tr>
<td class="bg2">&nbsp;</td>
<td class="bg2">
<input name="btnSubmit" type="button" class="btn" id="btnSubmit" value="登陆社区" onClick="javascript:doSubmit();"/>
</td>
</tr>
</table>
</form>
<%=COPYRIGHTFOOT%>
<%@ include file="../common/foot.inc"%>
</body>
</html>